package model

import "gorm.io/gorm"

type Customer struct {
	gorm.Model
	UserId                 int                      `gorm:"column:user_id" form:"userId" json:"userId"`
	Name                   string                   `gorm:"column:name" form:"name" json:"name"`                    //客户名称
	PhoneOne               string                   `gorm:"column:phone_one" form:"phoneOne" json:"phoneOne"`       //客户电话
	PhoneTwo               string                   `gorm:"column:phone_two" form:"phoneTwo" json:"phoneTwo"`       //客户电话
	PhoneThree             string                   `gorm:"column:phone_three" form:"phoneThree" json:"phoneThree"` //客户电话
	Avatar                 string                   `gorm:"column:avatar" form:"avatar" json:"avatar"`              //头像
	Type                   string                   `gorm:"column:type" form:"type" json:"type"`                    //分类：猪副、牛副
	Attribute              string                   `gorm:"column:attribute" form:"attribute" json:"attribute"`     //属性：熟食、加工厂、冻品批发
	Company                string                   `gorm:"column:company" form:"company" json:"company"`           //公司名称
	City                   string                   `gorm:"column:city" form:"city" json:"city"`                    //城市
	Market                 string                   `gorm:"column:market" form:"market" json:"market"`              //市场
	Address                string                   `gorm:"column:address" form:"address" json:"address"`           //地址
	WeiXin                 int                      `gorm:"column:wei_xin" form:"weiXin" json:"weiXin"`             //是否微信好友
	ProductStr             string                   `gorm:"column:product_str" form:"productStr" json:"-"`          //是否微信好友
	ProductList            []CustomerProduct        `gorm:"-" json:"productList"`
	Remark                 string                   `gorm:"column:remark" form:"remark" json:"remark"`        //备注
	CompanySalesRecord     []CompanySalesRecord     `gorm:"ForeignKey:CustomerId"  json:"companySalesRecord"` //购买记录
	SalesStatisticsProduct []SalesStatisticsProduct `gorm:"ForeignKey:CustomerId"  json:"salesProductList"`   //购买记录
}

type CustomerDetailResult struct {
	ID        uint
	UserId    int                  `form:"userId" json:"userId"`
	Name      string               `form:"name" json:"name"` //
	Phone     string               `form:"phone" json:"phone"`
	Avatar    string               `form:"avatar" json:"avatar"`
	City      string               `form:"city" json:"city"`
	Address   string               `form:"address" json:"address"`
	Company   string               `form:"company" json:"company"`
	Remark    string               `form:"remark" json:"remark"`
	SalesList []ProductSalesResult `form:"productList" json:"productList"`
}

type CustomerProduct struct {
	Id   int    `gorm:"column:id" form:"id" json:"id"`       //
	Name string `gorm:"column:name" form:"name" json:"name"` //
}
